package 力扣日常刷题.木22二月.第01天206;

/**
 * @author 帅小伙
 * @date 2022/2/6
 * @description
 * 数组查找  使用二分法
 */
public class Demo03JZ旋转数组的最小数字 {


    public int minArray(int[] numbers) {
        int l = 0, r = numbers.length - 1;

        while(l < r){
            int mid = (r - l) /2 + l;
            if(numbers[mid] < numbers[r]){
                r = mid;
            }else if (numbers[mid] > numbers[r]){
                l = mid + 1;
            }else {
                r -- ;
            }
        }
        return numbers[l];
    }
}
